package cn.momoshenchi;

import com.rabbitmq.client.Channel;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import java.io.IOException;

/**
 * @version : 1.0
 * @author: momoshenchi
 * @date: 2021/3/6 - 17:44
 */
@Component
public class Listener
{
    @RabbitListener(queues = "testDlx")
    public  void listendlx(Message message,Channel channel) throws IOException
    {
            long delivery=message.getMessageProperties().getDeliveryTag();

            System.out.println(new String(message.getBody()));

            channel.basicAck(delivery,true);

    }

}
